<!-- include tpl=head title=会员注册 -->
<script type="text/javascript">
function update_group(gid)
{
	$.phpok.go(get_url('register','','group_id='+gid));
}
function check_register()
{
	if(!$('#is_ok').prop('checked')){
		$.dialog.alert('注册前请先同意本站协议');
		return false;
	}
	$("#register-form").ajaxSubmit({
		'url':api_url('register','save'),
		'type':'post',
		'dataType':'json',
		'success':function(rs){
			if(rs.status){
				$.dialog.tips('会员注册成功',function(){
					$.phpok.go(get_url('index'));
				}).lock();
				return false;
			}
			$.dialog.alert(rs.info);
			return false;
		}
	});
	return false;
}
</script>

<section class="container">
	<div class="p-4 m-4">
		<form class="p-4 m-4" method="post" id="register-form" onsubmit="return check_register()">
			<h3 class="text-center p-4">会员注册</h3>
			<!-- if $grouplist && count($grouplist) > 1 -->
			<div class="row form-group">
				<label for="group_id" class="col-sm-3 text-right">会员组</label>
				<div class="col-sm-9">
					<select name="group_id" class="form-control" id="group_id" onchange="update_group(this.value)">
					<!-- loop from=$grouplist key=$key value=$value -->
					<option value="{$value.id}"{if $group_id == $value.id} selected{/if}>{$value.title}</option>
					<!-- /loop -->
					</select>
				</div>
			</div>
			<!-- /if -->
			<!-- if $group_rs.register_status && $group_rs.register_status != 1 -->
			<div class="row form-group">
				<label for="_code" class="col-sm-3 text-right">验证串：</label>
				<div class="col-sm-9">
					<input class="form-control" type="text" name="_code" id="_code" value="{$code}" readonly />
				</div>
			</div>
			<!-- /if -->
			<div class="row form-group">
				<label for="user" class="col-sm-3 text-right">账号：</label>
				<div class="col-sm-9">
					<input class="form-control" type="text" name="user" id="user" value="{$account}" placeholder="设置登录账号，支持中文" />
				</div>
			</div>
			<div class="row form-group">
				<label for="newpass" class="col-sm-3 text-right">密码：</label>
				<div class="col-sm-9">
					<input class="form-control" type="password" name="newpass" id="newpass" placeholder="设置密码，要求不少于6位，建议数字 + 字母" />
				</div>
			</div>
			<div class="row form-group">
				<label for="chkpass" class="col-sm-3 text-right">确认密码：</label>
				<div class="col-sm-9">
					<input class="form-control" type="password" name="chkpass" id="chkpass" placeholder="再次输入上面的密码" />
				</div>
			</div>
			<div class="row form-group">
				<label for="email" class="col-sm-3 text-right">Email：</label>
				<div class="col-sm-9">
					<input type="email" name="email" class="form-control" id="email" placeholder="填写电子邮件">
				</div>
			</div>
			<div class="row form-group">
				<label for="mobile" class="col-sm-3 text-right">手机号：</label>
				<div class="col-sm-9">
					<input type="tel" name="mobile" class="form-control" id="mobile" placeholder="填写要注册的手机号码">
				</div>
			</div>
			<!-- loop from=$extlist key=$key value=$value id=$tmpid -->
			<div class="row form-group">
				<label for="mobile" class="col-sm-3 text-right">{$value.title}：</label>
				<div class="col-sm-9">
					{$value.html}
				</div>
			</div>
			<!-- /loop -->
			<!-- if $is_vcode -->
			<div class="row form-group">
				<label for="_chkcode" class="col-sm-3 text-right">验证码：</label>
				<div class="col-sm-3">
					<input type="text" name="_chkcode" class="form-control" id="_chkcode" placeholder="填写右边图片上的数字" />
				</div>	
				<div class="col-sm-3" style="margin-top:5px;text-align:left;"><img src="" border="0" align="absmiddle" id="vcode" class="hand" /></div>
				<div class="col-sm-4"></div>
			</div>
			<script type="text/javascript">
			$(document).ready(function(){
				$("#vcode").phpok_vcode();
				$("#vcode").click(function(){
					$(this).phpok_vcode();
				});
			});
			</script>
			<!-- /if -->
			<div class="row form-group">
				<div class="col-sm-3"></div>
				<label class="col-sm-9"><input type="checkbox" id="is_ok" name="is_ok"> 我已阅读并完全同意阅读<a target="_blank" href="{url id=user-registration-agreement/}">注册协议</a></label>
		    </div>
		    <div class="row form-group">
				<div class="col-sm-3"></div>
				<div class="col-sm-6">
					<button type="submit" class="btn btn-primary">注册会员</button>
					
				</div>
				<div class="col-sm-3 text-right"><a href="{$sys.url}">返回首页</a></div>
			</div>
		</form>
	</div>
</section>
<!-- include tpl=foot -->